#include "Menu.h"

Menu::Menu( QWidget* parent )
	: QMenuBar( parent )
{
	// File Menu
	QMenu* fileMenu = new QMenu( tr( "File" ), this );
	addMenu( fileMenu );

	QAction* newAction = fileMenu->addAction( "New Database" );
	connect( newAction, SIGNAL( triggered() ), this, SLOT( newDatabase() ) );
	QAction* openAction = fileMenu->addAction( "Open Database" );
	connect( openAction, SIGNAL( triggered() ), this, SLOT( open() ) );
	QAction* saveAction = fileMenu->addAction( "Save Database" );
	connect( saveAction, SIGNAL( triggered() ), this, SLOT( save() ) );
	fileMenu->addSeparator();
	QAction* connectAction = fileMenu->addAction( "Connect" );
	connect( connectAction, SIGNAL( triggered() ), this, SLOT( connectDatabase() ) );
}

Menu::~Menu()
{
}

void
Menu::newDatabase()
{
	QString fileName = QFileDialog::getSaveFileName( this, tr( "Save File" ), "../resources/database/new_database.sql", tr( "SQL database (*.sql)" ) );
}

void
Menu::open()
{
	 QString fileName = QFileDialog::getOpenFileName( this, tr( "Open Database" ), "/database", tr( "Database Files (*)" ) );
}

void
Menu::save()
{
	QString fileName = QFileDialog::getSaveFileName( this, tr( "Save Database" ), "/database", tr( "Database Files (*)" ) );
}

void 
Menu::connectDatabase()
{
}